Truncate (x), Truncate (x, #places)

Truncate and Fix are equivalent functions. However, Truncate is preferred in Crystal syntax whereas Fix is preferred in Basic syntax.

Arguments
Returns

Fractional Number

Action

Truncate(x) returns a whole number by truncating the number at the decimal point. If the #places argument is specified, the number is truncated to the decimal place indicated and the function returns a fractional Number. If #places is negative, the number is rounded to the first ten, hundred, and so on.

Typical uses

Use this function whenever the characters to the right of the decimal are not needed for a report or calculation.

Examples

The following examples are applicable to both Basic and Crystal syntax, although Fix is preferred in the latter:

Truncate(1.23456)

Returns 1.

Truncate(1.499)

Returns 1.

Truncate(1.599)

Returns 1.

Truncate(1.999)

Returns 1.

Truncate(12346.33, 1)

Returns 12346.3.

Truncate(12345.33, -2)

Returns 12300.00.

If you have 147 golf balls in stock and want to know how many dozen are available for sale, your calculation is 147/12=12.25 12.25 (truncated) = 12 dozen available for sale. If you sell balls only by the dozen, the .25 dozen you truncated is unimportant.

Truncate({file.BALL INVENTORY} / 12)

Returns 12 where Ball inventory = 147 (147 / 12 = 12.25, 12.25 truncated = 12).

Truncate({file.BALL INVENTORY} / 12)

Returns 12 where Ball inventory = 155 (155/12 = 12.92, 12.92 truncated = 12).

Truncate({file.BALL INVENTORY} / 12)

Returns 13 where Ball inventory = 157 (157/12 = 13.08, 13.08 truncated = 13).

Comments

Truncate (-10.2)

Returns -10.

Int (-10.2)

Returns -11.

Related topics

Int (number)

Formula 13



Seagate Software IMG Holdings, Inc.
http://www.seagatesoftware.com
Support services:
http://support.seagatesoftware.com